<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('project_costs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('project_id');
            $table->unsignedBigInteger('user_id');
            $table->string('type')->comment('类型');
            $table->string('title', 255)->nullable()->default('/')->comment('项目名称');
            $table->decimal('price', 10, 2);
            $table->integer('rate')->default(0)->comment('费率/数量');
            $table->decimal('tax_price', 10, 2)->default(0)->comment('税金');
            $table->integer('total')->default(0)->comment('合计');
            $table->integer('is_system')->default(0)->comment('是否系统自带');
            $table->string('remarks')->nullable()->default('/');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('project_costs');
    }
};
